using System.Web.Mvc;
using TestingDAL.Models;

namespace TestingDAL.Controllers
{
    [HandleError]
    public class AlbumController : Controller
    {
        private readonly IAlbumDataContext _albumDataContext;

        public AlbumController()
        {
            _albumDataContext = new AlbumDataContext();
        }

        public AlbumController(IAlbumDataContext albumDataContext)
        {
            _albumDataContext = albumDataContext;
        }

        public ActionResult Index()
        {
            ViewData["Title"] = "List of Pink Floyd Albums";
            ViewData["Albums"] = _albumDataContext.GetAlbums();

            return View();
        }

        public ActionResult Individual(int id)
        {
            var album = _albumDataContext.GetAlbum(id);

            ViewData["Title"] = album.Name;
            ViewData["Album"] = album;

            return View();
        }

    }
}
